1. Field of Invention
The present invention relates to a drawing device that performs drawing processing of computer graphics.
2. Description of the Related Art
In general, for drawing graphics data given in a format, such as a triangle strip format (Triangle Strip), a triangle fan format (Triangle Fan), a scheme for switching between these (referred to as a snake format (Triangle Snake) hereafter), or a triangle mesh format (Triangle Mesh), a conventional drawing device used for drawing processing of computer graphics performs processing called rasterization for each individual triangle. By this processing, the graphics data is converted to information of each pixel.
FIG. 1 is a diagram showing a data format of a triangle strip.
In this triangle strip format, there are a vertex P0, a vertex P1, a vertex P2, a vertex P3, . . . , a vertex PNum−1, a vertex PNUM, and a vertex PNUM+1, for example. A triangle T0 is formed from three vertices, which are the vertex P0, the vertex P1, and the vertex P2. A triangle T1 is formed from three vertices, which are the vertex P1, the vertex P2, and the vertex P3. A triangle TN is formed from three vertices, which are the vertex PN, the vertex PN+1, and the vertex PN+2. When information of NUM triangles is to be described on the understanding that a triangle is represented by information of three vertices, information of 3*NUM vertices are required. However, as a feature of this triangle strip format, information of only NUM+2 vertices is required, allowing for a reduction in the amount of data.
FIG. 2 is a diagram showing a data format of a triangle fan.
In this triangle fan format, there are a vertex P0, a vertex P1, a vertex P2 a vertex P3, . . . , a vertex PNUM−1, a vertex PNUM, and a vertex PNUM+1, for example. A triangle T0 is formed from three vertices, which are the vertex P0, the vertex P1, and the vertex P2. A triangle T1 is formed from three vertices, which are the vertex P0, the vertex P2, and the vertex P3. A triangle TN is formed from three vertices, which are the vertex P0, the vertex PN+1, and the vertex PN+2. A feature of this data format is also that the amount of data can be reduced, as is the case with the triangle strip format.
FIG. 3 is a diagram showing a data format of a snake.
In the snake data format, a triangle strip and a triangle fan are freely switchable in midstream. Here, information that shows a switching point is separately needed. The amount of data in the snake format is the same as in the triangle strip format and the triangle fan format. However, because a connection state of consecutive triangles is uniquely predetermined for each case of the triangle strip format and the triangle fan format, not so many consecutive triangles can be expected unless conditions are satisfied. On the other hand, as a feature of this snake format, it is highly possible that more consecutive triangles can be formed owing to the flexibility.
FIGS. 4A and 4B are diagrams showing a data format of a triangle mesh.
In the triangle mesh format, information of vertices making up triangles is represented by an index/pointer 501 of vertex data. Although the data in this format often does not have information showing triangles that share a common edge, such information is added as needed.
Usually, an interim result or a final result of the drawing processing of computer graphics is placed in an external memory or an internal memory. This information includes: information of a distance viewed from each pixel; color information; and a degree of transparency. When processing is performed so as to reflect the information of each rasterized pixel in the interim result (such as a pixel color value or pixel depth information) that is placed in the memory, a current value needs to be read in from the memory and the result after the processing needs to be written back to the memory. In the case where the pixel is not transparent, its depth information (a value Z) is ignored, and the processing to reflect the latest information in the interim result placed in the memory is not performed, the interim result placed in the memory may not need to be read in. In this case, only writing processing is performed, cutting the time in half because the reading-in processing is unnecessary. Nonetheless, the substantial processing details are the same. An explanation is given as follows on the precondition that the interim result is read in.
In general, in order to obtain a screenful of processing results, it is necessary to process pixels, the number of which is many times larger than the size of the screen. Moreover, in animation processing, the screen needs to be updated some dozen times per second. For this reason, the pixel data has to be read in and written back at an extremely high speed. In most cases, this speed determines a speed of the drawing device.
Data can be transferred at an extremely high speed to and from a memory of recent years that is typified by a DDR SDRAM (Double Data Rate SDRAM). However, for getting the best performance, there is a constraint that requires data to be read or written in a sizable amount to a certain extent. This size has become larger as the processing speed becomes faster and the amount of data to be dealt with is increased. For this reason, the drawing device cannot read or write only one pixel of information desired out of one screen, but has to read or write information in a certain size at a time, as a pixel block, that is predetermined with respect to each system (about 4 to 256 pixels).
In most cases, a pixel area (pixel block) to be read or written at a time is one pixel high and horizontally long unless any innovation is made. However, the drawing device for computer graphics is designed to read and write in a data unit of a rough-square pixel block at a time. Reasons for the shape of square based on: that processing is performed for each pixel through the rasterization processing performed for each triangle; and that, on an average, there are more triangles which are not horizontally long than triangles which are horizontally long. That is to say, the number of unnecessary pixels located outside triangles is less when an area close to a square in shape, rather than a horizontally long area, is processed, and the efficiency is eventually increased as well. This is generally known (see Patent Reference 1, for example).
FIG. 5 is a diagram for explaining a case where a pixel block is horizontally long.
As shown in FIG. 5, an area (pixel block) 601 which is 1 pixel high by 64 pixels wide has only about 8 effective pixels coinciding with a triangle 602.
This means that the drawing device writes the pixel data of the pixel block into the memory, ending up writing the data most of which is unnecessary.
FIG. 6 is a diagram for explaining a case where a pixel block is square in shape.
As shown in FIG. 6, an area (pixel block) 701 which is 8 pixels high by 8 pixels wide has as many as 38 effective pixels coinciding with a triangle 702 that is the same as the triangle 602 shown in FIG. 5. In this way, it is obvious that there are more effective pixels in the square-shaped pixel block as compared with the horizontally long pixel block.
The above-mentioned Patent Reference 1 discloses the invention not regarding information of individual pixels, but regarding texture data to be applied to a triangle, wherein data is arranged for each 8 by 8 pixel block. This is based on the same reasons as described above.    Patent Reference 1: Japanese Translation of PCT Application laid open as JP2001-507836